<template>
    <div>
        <h2>{{ num }}</h2>
        <h2>{{ str }}</h2>
        <h2>{{ evenOrOdd }}</h2>
        <button @click="add">加1</button>
        <button @click="jian">减1</button>
        <button @click="oddAdd">奇数+1</button>
    </div>
</template>

<script>
import {mapState,mapGetters,mapMutations,mapActions} from "vuex";
    export default {
        mounted(){
            console.log(this.$store);
            console.log(this.$store.state.num);
        },
        data(){
            return{
                count:0
            };
        },
        computed:{
            ...mapState(["num","str"]),
            ...mapGetters(["evenOrOdd"]),
        },
        methods:{
            ...mapMutations(["add","jian"]),
            ...mapActions(["oddAdd"]),
        }
    }
</script>

<style lang="scss" scoped>

</style>